﻿@{
    Layout = null;
}
@Html.Action("Account_Show", "Account");
    <div class="content">
        <div class="right" id="mainFrame">
            <div class="right_cont">
                <div class="header">
                    <div class="header-right">
                        <form method="post" action="/Custom_Info/Custom_Info_Add">
                            <div id="modal-container-973559" class="modal hide fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="width:400px; margin-left:-150px;">
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                                    <h3 id="myModalLabel">
                                        客户新增系统
                                    </h3>
                                </div>
                                <div class="modal-body">

                                    <table class="table table-hover table-bordered " style="width:400px;text-align:center;margin:0 auto;border:2px solid #428bca;">
                                        <tbody>
                                            <tr>
                                                <th>收件人</th>
                                                <td>
                                                    <select id="Select1"></select>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>快递单号</th>
                                                <td><input type="text" name="Weigh_dan" style="width:130px;" id="Weigh_dan" /></td>
                                            </tr>
                                            <tr>
                                                <th>货物重量(公斤)</th>
                                                <td><input type="text" name="Weigh_zhong" style="width: 130px;" id="Weigh_zhong" /></td>
                                            </tr>
                                            <tr>
                                                <th>应收费(元)</th>
                                                <td><input type="text" name="Weigh_money" style="width: 130px;" id="Weigh_money" /></td>
                                            </tr>
                                        </tbody>
                                    </table>

                                </div>
                                <div class="modal-footer">
                                    <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button> <button type="button" class="btn btn-default" onclick="bu()"><span class="icon-inbox"></span>保存</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <!-- 顶部 -->
                    <div class="right" id="mainFrame">

                        <div class="right_cont">
                            <ul class="breadcrumb">
                                当前位置：
                                <a href="/Home/Index">首页</a>
                                <span class="divider">/</span>
                                订单管理
                                <span class="divider">/</span>
                                称重
                            </ul>
                         
                            <div style="width:100%; margin-top:10px">
                                <form action="/Purchaseto/Getchaxun">
                                    <div>
                                        <table>
                                            <tr>
                                                <td>快递单号:</td>
                                                <td>@Html.TextBox("danhao")</td>
                                                <td><button type="submit" class="btn btn-default" style="margin-bottom:10px"><span class="icon-search"></span>查询 </button></td>
                                                <td><button id="modal-973559" href="#modal-container-973559" role="button" type="button" class="btn btn-default" data-toggle="modal" style="margin-bottom:10px"><span class="icon-plus"></span>新增</button></td>
                                            </tr>
                                        </table>
                                    </div>
                                </form>
                                <div style="margin-top:20px;">
                                    <table id="table1" class="table  table-hover table-bordered table-striped">
                                        <thead>
                                            <tr>
                                                <th>称重编码</th>
                                                <th>客户名称</th>
                                                <th>客户手机号</th>
                                                <th>快递单号</th>
                                                <th>包裹重量</th>
                                                <th>应收费</th>
                                                @*<th>操作</th>*@
                                            </tr>
                                        </thead>
                                        <tbody>
                                            @foreach (var item in Model)
                                            {
                                                <tr>
                                                    <td>@item.Weigh_Id</td>
                                                    <td>@item.Shipments_Per</td>
                                                    <td>@item.Shipments_Phone</td>
                                                    <td>@item.Weigh_danhao</td>
                                                    <td>@item.Weigh_kilogram</td>
                                                    <td>@item.Weigh_money</td>
                                                </tr>
                                            }

                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
<script>
    $(function () {
        $.ajax({
            url: "/Purchaseto/Get_xiala",
            type: "post",
            success: function (d) {
                //添加下拉框元素
                $(d).each(function (index, item) {
                    //拼接 元素
                    var option = '<option value="' + item.Shipments_Id + '">' + item.Shipments_Per + '</option>';
                    $("#Select1").append(option);
                });
            }
        })
    })
    function bu() {
        var aa = $("[name=Weigh_dan]").val();
        var bb = $("[name=Weigh_zhong]").val();
        var cc = $("[name=Weigh_money]").val();
        var dd = $("#Select1").val();
       
        $.ajax({
            url: "/Purchaseto/Getadd",
            type: "post",
            data: {
                Shipments_Id: dd,
                Weigh_money: cc,
                Weigh_kilogram: bb,
                Weigh_danhao: aa
            },
            success: function (data) {

                if (data != null) {
                    alert("添加物品成功");
                    location.reload();
                }
                else {
                    alert("添加物品失败");
                }

            }
        })
    }
</script>